home *** CD-ROM | disk | FTP | other *** search
- Path: news.iosphere.net!usenet
- From: ianq@sonetis.com (Ian V. Quickmire)
- Newsgroups: comp.lang.c++
- Subject: Unable to use 'delete' after 'new'
- Date: Fri, 22 Mar 1996 18:34:54 GMT
- Organization: IQ Systems Ltd.
- Distribution: inet
- Message-ID: <4iursi$ibc@lisa.iosphere.net>
- Reply-To: ianq@sonetis.com
- NNTP-Posting-Host: port016-35-yow.iosphere.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- I have 2 definitions of new arrays that I allocate that I am unfortunately
- having a hard time deleting afterwards.
-
- 1 - int *iColsize = new int[cCols];
-
- The trick here is that I need to return this array to the calling function,
- which then processes the data.
-
- How do I do the delete from the calling function as opposed to within the
- function the NEW was executed.
-
- I tried the basic delete [] iColsize from the calling function, and got a
- memory exception.
-
-
- 2 - char (*sPassStr)[MAX_COLSIZE + 1] = new
- char[iColsize[0]][MAX_COLSIZE + 1];
-
- The problem here lies with an ODBC function I execute.
-
- char (*sPassStr)[MAX_COLSIZE + 1] = new char[iColsize[0]][MAX_COLSIZE + 1];
- SQLBindCol(hstmt, i, SQL_C_CHAR, sPassStr[i], iColsize[i], &cbTemp);
- retcode = SQLFetch(hstmt);
-
- Up until I do the SQLFetch, I can do a 'delete [] sPassStr' fine.
- After the Fetch is executed, if I do a delete, I get a memory exception.
-
- Any ideas?
-
- --------------------------------------------------------------
- Work: izq00@ccc.amdahl.com Home: ianq@sonetis.com
- WWW: http://www.sonetis.com/~ianq/ CIS: 74032,573
- --------------------------------------------------------------
-
-